package com.community.backend.mapper;

import cn.hutool.system.UserInfo;
import com.community.backend.annotation.AutoFill;
import com.community.backend.enumeration.OperationType;
import com.community.backend.pojo.Admin;
import com.community.backend.pojo.User;
import com.community.backend.pojo.dto.RegisterDTO;
import com.community.backend.pojo.dto.UserQueryDTO;
import com.community.backend.pojo.vo.UserQueryVO;
import com.community.backend.pojo.vo.UserRoomVO;
import com.community.backend.pojo.dto.UserDTO;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserMapper {
//    void register(RegisterDTO registerDTO);

    Page<UserQueryVO> pageQuery(UserQueryDTO userQueryDTO);
    @AutoFill(OperationType.UPDATE)
    Integer update(User user);

    @AutoFill(OperationType.INSERT)
    Integer addUser(User user);

    List<UserRoomVO> searchRoom(UserDTO userDTO);

    User login(String username, String password);
    @Select("select * from user where id = #{id} and isDelete = '未删除'")
    User selectById(String id);
    @AutoFill(OperationType.UPDATE)
    Integer updateById(User user);
    @Select("select count(*) from user where isDelete = '未删除'")
    Integer selectAll();
}
